//长度为奇数的环可以跟自己合并;长度为偶数的环,可以跟长度一样的环合并 

#include<stdio.h>
#include<string>
#include<cmath>
#include<algorithm>

using namespace std;

#define MAX 30

char value[MAX];
int circle[MAX];
int lenth[MAX];

int main()
{
    int casecount,caseid;
    int circlecount;
    int i,j,now;
    int ok;
    
    scanf("%d",&casecount);
    for(caseid=1;caseid<=casecount;caseid++)
    {
        scanf("%s",value);
        circlecount=0;
        memset(circle,0,sizeof(circle));
        for(i=0;i<26;i++)
        {
            now=i;
            if(circle[now]==0)
                circlecount++;
            while(circle[now]==0)
            {
                circle[now]=circlecount;
                now=value[now]-'A';
            }    
        }
        
        memset(lenth,0,sizeof(lenth));
        for(i=0;i<26;i++)
        {
            lenth[circle[i]-1]++;
        }  
        
        sort(lenth,lenth+circlecount);
        
        ok=1;
        for(i=0;i<circlecount;i++)
        {
            if(lenth[i]%2==0)
            {
                if(lenth[i]!=lenth[i+1])
                {
                    ok=0; break;
                }
                else
                {
                    i++;
                }        
            }
        }   
        
        if(ok==1)
        {
            printf("Yes\n");
            //printf("%d\n\n",circlecount);
        }
        else
        {
            printf("No\n");
            //printf("%d\n\n",circlecount);
        }                                                                                                          
        
        
    }    
    
    
    
    
    return 0;
}    

